import service from "@/utils/request";

export function addFaculty(data: object) {
  return service({
    url: '/orgs/depts/',
    method: 'post',
    data
  })
}

export function updateFaculty(id: any, data: object) {
  return service({
    url: `/orgs/depts/${id}`,
    method: 'put',
    data
  })
}

export function deleteFaculty(id: string) {
  return service({
    url: `/orgs/depts/${id}`,
    method: 'delete',
  })
}

export function importBatch(data: any) {
  return service({
    url: "/orgs/depts/batchImportDepts",
    method: 'post',
    data
  })
}

export function exportBatch(id: any) {
  return service({
    responseType: 'blob',
    url: "/orgs/depts/noAuthExcel/export",
    method: 'get',
    params: {
      univId: id
    }
  })
}

export function getFacultyPage(schoolId: string, pageIndex: number, pageSize: number) {
  return service({
    url: `/orgs/depts/searchDeptsByUnivId/${pageIndex}/${pageSize}?univId=${schoolId}`,
    method: 'get',
  })
}

export function searchFacultyPage(schoolId: any, queryInfo: string, pageIndex: number, pageSize: number) {
  return service({
    url: `/orgs/depts/searchDeptByDeptName/${pageIndex}/${pageSize}?deptname=${queryInfo}&univId=${schoolId}`,
    method: 'get',
  })
}